﻿using Appliaction.Dto.Base_Manage;
using Appliaction.IAppServices.Base_Manage;
using AutoMapper;
using Domain.Entitys.Base_Manage;
using Domain.IRepositorys.Base_Manage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Appliaction.AppServices.Base_Manage
{
    public class DicttypeService : IDicttypeService
    {
        private readonly IDicttypeRepository dicttypeRepository;
        private readonly IMapper mapper;

        public DicttypeService(IDicttypeRepository dicttypeRepository, IMapper mapper)
        {
            this.dicttypeRepository = dicttypeRepository;
            this.mapper = mapper;
        }
        /// <summary>
        /// 查询总条数
        /// </summary>
        /// <param name="Dict_name"></param>
        /// <param name="Dict_type"></param>
        /// <param name="Status"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public int Getsys_Dict_TypesCount(string Dict_name, string Dict_type, char Status)
        {
            return dicttypeRepository.Getsys_Dict_TypesCount(Dict_name, Dict_type, Status);
        }
        /// <summary>
        /// 分页查询、条件查询
        /// </summary>
        /// <param name="Dict_name"></param>
        /// <param name="Dict_type"></param>
        /// <param name="Status"></param>
        /// <param name="currentPage"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public List<Sys_Dict_Type> Getsys_Dict_TypesFyWhere(string Dict_name, string Dict_type, char Status, int currentPage, int pageSize)
        {
            return dicttypeRepository.Getsys_Dict_TypesFyWhere(Dict_name, Dict_type, Status, currentPage, pageSize);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="AddDto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<int> Postsys_Dict_TypesAdd(DictTypesAddDto AddDto)
        {
            Sys_Dict_Type sys_Dict_Type = mapper.Map<Sys_Dict_Type>(AddDto);
            return await dicttypeRepository.Postsys_Dict_TypesAdd(sys_Dict_Type);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="DeleteDto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<int> Putsys_Dict_TypesDelete(DictTypesDeleteDto DeleteDto)
        {
            Sys_Dict_Type sys_Dict_Type = mapper.Map<Sys_Dict_Type>(DeleteDto);
            return await dicttypeRepository.Putsys_Dict_TypesDelete(sys_Dict_Type);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="UpdateDto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<int> Putsys_Dict_TypesUpdate(DictTypesUpdateDto UpdateDto)
        {
            Sys_Dict_Type sys_Dict_Type = mapper.Map<Sys_Dict_Type>(UpdateDto);
            return await dicttypeRepository.Putsys_Dict_TypesUpdate(sys_Dict_Type);
        }
    }
}
